package com.minstone.api.unit.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.minstone.api.unit.bean.UnitInfoBean;
import com.minstone.api.unit.dao.UnitInfoDao;
import com.minstone.api.unit.service.IUnitInfoService;
import com.minstone.common.util.ResultPage;

@Service
public class UnitInfoServiceImpl implements IUnitInfoService {

	@Autowired
	private UnitInfoDao unitInfoDao;

	@Override
	public Map selectUnitInfo(Map param, int pageIndex, int pageRowNum) {
		// mybatis分页助手
		PageHelper.startPage(pageIndex, pageRowNum);
		List<UnitInfoBean> list = this.unitInfoDao.selectUnitInfo(param);
		PageInfo<UnitInfoBean> pageInfo = new PageInfo<UnitInfoBean>(list);
		return ResultPage.getPageData(pageRowNum, pageIndex, pageInfo.getTotal(), list);
	}

}
